package com.qingzhuge.member.controller;

import com.qingzhuge.controller.base.AbstractController;
import com.qingzhuge.dto.response.ResponseBodyDto;
import com.qingzhuge.member.dto.WxUserInfoRequestDto;
import com.qingzhuge.member.dto.response.SysMemberDto;
import com.qingzhuge.member.entity.SysMember;
import com.qingzhuge.member.service.wx.IWxUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author : zero.xiao
 * @description : 微信小程序用户接口
 * @date :2018/10/17 0017 下午 12:06
 * @since : 1.0.0
 * @modified :
 */
@Api(tags = "A第三方用户信息")
@RestController
@RequestMapping("/api/auth/oauth/wx/user/{appid}")
public class ApiWxMaUserController extends AbstractController {
    @Resource
    private IWxUserService wxUserService;


    @ApiOperation("用户绑定手机号")
    @PutMapping("/mobile")
    public ResponseEntity<ResponseBodyDto<SysMemberDto>> mobile(@PathVariable String appid, @RequestBody WxUserInfoRequestDto request) {
        SysMember res = wxUserService.updateMobile(appid, request,getUid());
        return returnSuccess(doBean2Dto(res, SysMemberDto.class));
    }

}
